<?php
// $Id: forums.tpl.php,v 1.4 2007/08/07 08:39:35 goba Exp $

/**
 * @file forums.tpl.php
 * Default theme implementation to display a forum which may contain forum
 * containers as well as forum topics.
 *
 * Variables available:
 * - $links: An array of links that allow a user to post new forum topics.
 *   It may also contain a string telling a user they must log in in order
 *   to post.
 * - $forums: The forums to display (as processed by forum-list.tpl.php)
 * - $topics: The topics to display (as processed by forum-topic-list.tpl.php)
 * - $forums_defined: A flag to indicate that the forums are configured.
 *
 * @see template_preprocess_forums()
 * @see theme_forums()
 */
 

if($item) {
?>

<table class="item_frame_container" width="255" border="1">
<tr>
  <td width="51"><img src="http://www.wowarmory.com//wow-icons/_images/51x51/<?php echo $item->icon;?>.jpg" /></td>
  <td width="200">
    <?php
	printf("<p class='overallQualityId%d'>%s</p>\n",$item->overallQualityId,check_plain($item->name));
	printf("<div>%s</div>\n",$item->bonding);
	printf("<div><div style='float:right'>%s</div><div>%s</div></div>\n",check_plain($item->subclassName),check_plain($item->inventoryType));
	if($item->damage) {
      printf("<div><div style='float:right'>%s</div><div>%s</div></div>\n",t("Speed ") . check_plain($item->damagespeed),check_plain($item->damage) . t(" Damage"));
      printf("<div>(%0.1f %s)</div>\n",$item->damagedps,t("damage per second"));
	}
	
	

	if($item->armor) printf("<div>%s %s</div>\n",$item->armor,t("armor"));
	if($item->bonusStrength) printf("<div>%s %s</div>\n",check_plain($item->bonusStrength),t("Strength"));
	if($item->bonusAgility) printf("<div>%s %s</div>\n",check_plain($item->bonusAgility),t("Agility"));
	if($item->bonusStamina) printf("<div>%s %s</div>\n",check_plain($item->bonusStamina),t("Stamina"));
	if($item->bonusIntellect) printf("<div>%s %s</div>\n",check_plain($item->bonusIntellect),t("Intellect"));

    if($item->socketData) {
	    $tmp = '<ul>';
	    foreach($item->socketData->socket as $ele) {
		  $tmp .= '<li>' . check_plain($ele['color']) . ' socket</li>';
		}
		if($item->socketData->socketMatchEnchant) {
		  $tmp .= '<li>Matching Bonus: ' . check_plain($item->socketData->socketMatchEnchant) . '</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
		
	  }

	if($item->durability) printf("<div>%s: %d / %d</div>\n",t("Durability"),$item->durability,$item->durability);
	if($item->allowableClasses) printf("<div>%s: %s</div>\n",t("Allowable classes"),check_plain($item->allowableClasses));
	if($item->requiredLevel) printf("<div>%s: %d</div>\n",t("Required level"),$item->requiredLevel);

	if($item->bonusCritRating) printf("<div>+%s %s</div>\n",check_plain($item->bonusCritRating),t("Crit Rating"));
	if($item->bonusCritSpellRating) printf("<div>+%s %s</div>\n",check_plain($item->bonusCritSpellRating),t("Spell Crit Rating"));
	if($item->bonusResilienceRating) printf("<div>+%s %s</div>\n",check_plain($item->bonusResilienceRating),t("Resiliance"));
	if($item->bonusHitSpellRating) printf("<div>+%s %s</div>\n",check_plain($item->bonusCritRating),t("Spell Hit Rating"));
	if($item->bonusHasteRating) printf("<div>+%s %s</div>\n",check_plain($item->bonusHasteRating),t("Haste Rating"));

	  // Spells
	  if($item->spellData) {
	    $tmp = '<ul>';
	    foreach($item->spellData->spell as $ele) {
		  $tmp .= '<li>' . ($ele->trigger==1?'Equip:':'Use:') . ' ' . check_plain($ele->desc) . '</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
	  }
	  // Set
	  if($item->setData) {
	    $tmp = '<ul>';
		$tmp .= '<li>' . check_plain($item->setData->name) . '</li>';
	    foreach($item->setData->item as $ele) {
		  $tmp .= '<li>' . check_plain($ele['name']) . '</li>';
		}
		$tmp .= "<li>Set Bonus:</li>";
	    foreach($item->setData->setBonus as $ele) {
		  $tmp .= '<li>(' . check_plain($ele['threshold']) . ') Set: ' . check_plain($ele['desc']) .'</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
    }

//	if($item->setData) echo print_r($item->setData,true);
    ?>
  </td>
</tr>
</table>

<!--<pre><?php print_r($item); ?></pre>-->


<?php
} else {
	print("Item not found");
}
?>

